www.mxdraw.com
内容索引主面
前一个向上下一个
IMxDrawUtility::GetPoint 方法

与用户交互到在图上提取一个点

IDL
[helpstring("method GetPoint")]
HRESULT GetPoint([in] IMxDrawPoint* point, [in] BSTR prompt, [out,retval] IMxDrawPoint** pPoint);
参数 
说明 
[in] IMxDrawPoint* point 
交互提取时,前一个参考点,可以传为null 
[in] BSTR prompt 
命令提示字符串 

返回提取到的点,返回null表示没成功得到点

例如: Delphi中取一个点的例程代码

    procedure TForm1.DoInsertFlagClick();
    var
            ptInsert        : OleVariant;
            pt              :  IMxDrawPoint ;
    begin
        ptInsert := mxUtility.GetPoint(EmptyParam,'点插入点');
        pt:=IMxDrawPoint(IDisPatch(ptInsert));
        if pt = nil then
            EXIT;
        MxDrawX1.InsertBlock(MxDrawX1.GetOcxAppPath() + 'blkTsgNote.dwg','Flag');
        MxDrawX1.DrawBlockReference(pt.Get_x(),pt.Get_y(),'Flag',10.0,0.0);

    end;

 

例如: C# 求两点距离

    MxDrawUtility mxUtility  = new MxDrawUtility();

     MxDrawPoint point = (MxDrawPoint)(mxUtility.GetPoint(null, "点取第一点:") );

     if (point == null)
     {
         MessageBox.Show("用户取消..");
         return;
     }

     MxDrawPoint point2 = (MxDrawPoint)(mxUtility.GetPoint(point, "点取第二点:"));

     if (point2 == null)
     {
         MessageBox.Show("用户取消..");
         return;
     }

     Double dDis = Math.Sqrt((point.x - point2.x) * (point.x - point2.x)
         + (point.y - point2.y) * (point.y - point2.y));

     MessageBox.Show("两点距离:" + dDis.ToString());
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!